<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>月票卡订单</title>
		<style>
			.grayState{
				color: #8e8e93;
			}
			.yellowState{
				color: #fea715;
			}
			.redState{
				color: #ff3b2f;
			}
			.hide{
				display: none!important;
			}
		</style>
		<link rel="stylesheet" href="css/main.css" />
	</head>
	<body>
		<script src="js/jquery.min.js"></script>
		<script type="text/javascript" src="./js/code.js" ></script>
		<script type="text/javascript" src="js/oldPublic.js" ></script>
		<script src="//systatic.efzhou.com/sensors/sensorsdata.min.js"></script>
		<script src="//systatic.efzhou.com/fzstatic/platform.js"></script>
		<script type="text/javascript" src="js/main.js" ></script>
		<div class="wrapOrderlist">
		<!--	<header><img class='goBack()' src="img/back.png"  /><p>月票卡订单</p></header>-->
			<div class="wrapList">
				<ul>
					<li>
						<p class="pTitle"><span>学生月票卡</span><small>审核中</small></p>
						<p class="pContent">
						<span class="spantime">申请时间：2015年5月11日 12:00</span>
						<span class="spanprice">费用：28元</span>
						<span class="spanType">取卡方式：自取</span>
						</p>
						<span class="changeAddress">修改地址</span>
					</li>
					<li>
						<p class="pTitle"><span>学生月票卡</span><small>审核中</small></p>
						<span class="spantime">申请时间：2015年5月11日 12:00</span>
						<span class="spanprice">费用：28元</span>
						<span class="spanType">取卡方式：自取</span>
					</li>
				</ul>
			</div>
			<div class="noRecode">
				<h3><img src="img/noRecord.jpg" /></h3>
				<span>暂无订单列表哦</span>
			</div>
		</div>
		<script>
			var key = "841B295FF2034BB6A4770DB0599AB885" + "841B295FF2034BB6";   
			var payData =  {
				tag:'6007',
				uniqueId:sessionStorage.getItem('uniqueId')||'',
			}
				payData=JSON.stringify(payData);
				$.ajax({
					type:"post",
					url:sessionStorage.getItem('locationUrl'),
					data:{
		    			'data':encryptByDESModeEBC(key, payData),
		    			sessionid:'11149',
		    		},
					success:function(data){
						data = decryptByDESModeEBC(key, data);
                    	var lastIndex = data.lastIndexOf('}');
            	        data= data.substring(0,lastIndex+1);
            	        data = JSON.parse(data);
            	        maiEvent("FZRCTLBLSumbit",{action_type: "3"})
            	        if(data.result=='00'){  //返回成功

							var dataTmp = data.data;//shiwei 20200319 添加

            	        	if(data.data){
            	        		data = JSON.parse(data.data);
            	        	}

	            	     	var str = '';
							 //if(data.data){//shiwei 20200319 注释
	            	     	 if(dataTmp){//shiwei 20200319 添加
	            	     	 	for(var i=0;i<data.length;i++){
	            	     	 		var listInfo = JSON.stringify(data[i]);
	            	     	 		var isHasaddress = 'changeAddress';
	            	     	 		if(data[i].checkstatus!='2'&&data[i].getcardtype!='2'){
	            	     	 			isHasaddress = 'hide'
	            	     	 		}
		            	     		str+="<li>"+
											"<p class='pTitle'><span>"+ticketType(data[i].type)+"</span><small class="+changeClass(data[i].checkstatus)+" >"+checkstatus(data[i].checkstatus,data[i].type)+"</small></p>"+
											"<p class='pContent' onclick='gotoDetil("+listInfo+")'>"+
											"<span class='spantime'>申请时间："+formateData(data[i].createtime)+"</span>"+
											"<span class='spanprice'>费用："+money(data[i].amt)+"</span>"+
											"<span class='spanType'>取卡方式："+getcardtype(data[i].getcardtype)+"</span>"+
											"</p>"+
											"<span class="+isHasaddress+" onclick='gotoChangeAddress("+listInfo+")'>修改地址</span>"+
										"</li>"
		            	     	}
	            	     	 }else{
	            	     	 	$('.noRecode').show();
	            	     	 }
            	        }
            	        $('ul').html(str);
					}
				});
				
				function ticketType(type){
					return type=='1'?'学生月票卡':'成人月票卡';
				}
				function formateData(time){
					return time.substring(0,4)+'年'+time.substring(4,6)+'月'+time.substring(6,8)+'日'+time.substring(8,time.length);
				}
				function getcardtype(getcardtype){
					//return getcardtype=='0'?'自取':'邮寄';//shiwei 20200319 注释
					return getcardtype=='2'?'邮寄':'自取';//shiwei 20200319 添加
				}
				function gotoDetil(orderinfo){
					var orderinfo = JSON.stringify(orderinfo);
					orderinfo = encodeURIComponent(orderinfo);
					window.location.href = './orderDetil.html?orderInfo='+orderinfo;  
				}
				function gotoChangeAddress(){
					var orderinfo = JSON.stringify(orderinfo);
					orderinfo = encodeURIComponent(orderinfo);
					window.location.href = './changeAddress.html?orderInfo='+orderinfo;  
				}
				function money(money){
					var money;
					if(money){
						money = (money/100)+"元";
					}else{
						money = '未支付'
					}
					return money;
				}
				
				function checkstatus(checkstatus,type){
					var checkstatusText = '';
					switch (checkstatus){
						case '-1':
						checkstatusText = '订单已关闭'
						break;
						case '-2':
						checkstatusText = '订单异常'
						break;
						case '-3':
						checkstatusText = '审核未通过已退款'
						break;
						case '0':
						checkstatusText = '未支付'
						break;
						case '1':
						checkstatusText = '支付中'
						break;
						case '2':
						checkstatusText = '已支付审核中'
						break;
						case '3':
						checkstatusText = '已审核'
						break;
						case '4':
						checkstatusText = '待取卡'
						break;
						case '5':
						checkstatusText = '已完成'
						break;
						case '6':
						checkstatusText = '制卡中'
						break;
						case '7':
						checkstatusText = '已邮寄'
						break;
						case '8':
						checkstatusText = '订单已取消'
						break;
						default:
						break;
					}
					if(type!=1&&checkstatus==2){
						checkstatusText = '已支付待发卡'
					}
					return checkstatusText;
				}
				
				function changeClass(checkstatus){
					var checkstatusClass = '';
					switch (checkstatus){
						case '0':
						checkstatusClass = 'grayState'
						break;
						case '1'||'4':
						checkstatusClass = 'yellowState'
						break;
						case '2'||'-2':
						checkstatusClass = 'redState'
						break;
						case '3'||'-3':
						checkstatusClass = 'yellowState'
						break;
						case '5'||'-1'||'8':
						checkstatusClass = 'grayState'
						break;
						default:
						break;
					}
					return checkstatusClass;
				}
				
				$('.goBack').click(function(){
					history.back();
				})
		</script>
	</body>
</html>
